package com.changgou.business.dao;

import com.changgou.business.pojo.Seconds;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

public interface SecondsMapper extends Mapper<Seconds> {
    /**
     * 根据时间段查询秒杀商品列表
     * @param starttime
     * @param endtime
     * @return
     */
    @Select("select s.* from tb_seconds s " +
            "left join tb_seckill_goods sg on sg.seconds_id = s.id " +
            "where TIME(sg.start_time) >= #{starttime} " +
            "and TIME(sg.end_time)<= #{endtime}")
    Page<Seconds> findGoodsBySid(@Param("starttime") String starttime,@Param("endtime") String endtime);

    @Select("select * from tb_seconds " +
            "where goodsName like #{goodsName} " +
            "or articleNumber like #{goodsName} ")
    Page<Seconds> findSeckillGoodsByName(@Param("goodsName") String goodsName);
}
